package com.example.demo.service;


import com.example.demo.bean.salesorder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service //将类交由spring管理
public class salesorderService {

    @Autowired
    private com.example.demo.Dao.salesorderdao salesorderdao;

    /**
     * 添加信息
     * @paramordersid,customername,staffname,shopname,staffyear,ordersquantity,shopprice,ordersstate
     * @returnint ordersid,String customername,String staffname,String shopname,int staffyear,int ordersquantity,int shopprice,String ordersstate
     */
    public int Insertsalesorder(salesorder salesorder){
         salesorderdao.insert(salesorder);return 1;
    }

    /**
     * 通过商品编号删除数据
     * @param
     * @return
     */
    public int Deletesalesorder(Integer ordersid){

         salesorderdao.deleteById(ordersid);return 1;
    }

    /**
     * 修改信息
     * @paramordersid,customername,staffname,shopname,ordersquantity,shopprice,ordersprice,ordersstate
     * @returnint ordersid,String customername,String staffname,String shopname,int ordersquantity,int shopprice,int ordersprice,String ordersstate
     */
    public int Updatesalesorder(salesorder  salesorder) {

        salesorderdao.updateById(salesorder);return 1;
    }

    /**
     * 显示所有数据
     * @return
     */
    public List<salesorder> ShowAllsalesorder() {
        return salesorderdao.ShowAllsalesorder();
    }

    /**
     * 通过名称查询数据
     * @param number
     * @return
     */
//    public salesorder Showsalesorder(Integer number){
//        return salesorderdao.Showsalesorder(number);
//    }

    /**
     * 查询商品总数
     * @return
     */
    public int Totalsalesorder(){salesorderdao.Totalsalesorder();
        return 1;
    };

}
